Skip to content

The install's own AWS account gets each release's reads with the release, and no alert ever - #789

Merged
nambok merged 1 commit into
mainfrom
own-account-reader-with-release
Nov 19, 2026
Merged

nambok merged 1 commit into
mainfrom
own-account-reader-with-release

Conversation

@nambok

@nambok nambok commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A self-hosted install's owner got a push alert saying the install's own AWS account "needs 1 new read-only permission". There were two causes:

  • The flag was never set. The daily sweep skips the install's own account only when PermissionCheck.install_account is true. The check's builder always wrote install_account: false (services/common/src/live/permissions.rs:112). Only tests ever set it, and nothing in production called live::aws::in_install_account. So that account was treated like any other: the sweep pushed the alert (passes/aws_permissions.rs:223), and the AWS page offered the one-click update stack.
  • The role really did fall behind. Since Every team AWS read is made as the team's role #782, every team read in the install's own account is made as CoderHelmLogReader. That role's stack is separate, and no release updated it.

This PR changes three things:

  • No push, ever. The daily sweep only checks the accounts and saves the results. Another account shows the update as the AWS page's quiet item, with its one-click stack.
  • The flag is set where the check is built. The builder sets it from the install's read role, and only on a one-stack install, which is the only kind whose release keeps that role current.
  • The release brings the reads itself. The access stack gains a reader update. After each update of the install's stack, it creates or updates CoderHelmLogReaderUpdate-release from the running release's published update template, with read-only groups only. No person does anything.

Changes

  • Services:
    • live/aws.rs: reader_updates_with_release, updates_with_release and INSTALL_READER_KEPT.
    • live/permissions.rs:
      • PermissionCheck::new sets install_account from this process's install role (for_install is the pure form), and check goes through the new check_for.
      • The install_update fix now says "Nothing to do: the release brings...".
    • live/aws_account.rs: a check saved before this change is corrected on read.
    • gateway/routes/integrations.rs: the account line now reads "Updates with the release: ... Nothing to do."
  • Worker: passes/aws_permissions.rs sends nothing. The message, the AWS_PERMS_NOTICE told and claim records, should_tell, teams_told and notify::messages::aws_permissions_update are removed.
  • Reader update (new lambda/native-reader/handler.py):
    • When it runs: on the install stack's UPDATE_COMPLETE event, once a day, and when the access stack is created or updated.
    • What it does: when CoderHelmLogReader exists, it creates or updates the one stack CoderHelmLogReaderUpdate-release from https://coderhelm-public.s3.amazonaws.com/launch/<running version>/coderhelm-log-reader-update.yaml.
    • Parameters: the three AWS card switches as the install's stack has them. Everything else is empty or off: no knowledge bases, buckets, sync, WAF logs, databases, warehouses or maintenance. It passes only the parameters the template declares.
    • Failures: as a custom resource it always answers SUCCESS. A stack in ROLLBACK_COMPLETE is removed and made again. It never reads the event it is sent.
  • Access stack (infra/lib/native/access-stack.ts):
    • New resources: ReaderRole, Reader, ReaderAfterUpdate, ReaderDaily, two Lambda::Permissions and ReaderNow. They are added to ACCESS_SHAPE, and their names sit outside the install prefix (CoderHelmReader-<stage>).
    • The role may only:
      • create or update that one stack, only when cloudformation:TemplateUrl matches a release's update template;
      • put, get or delete inline policies on CoderHelmLogReader, only when aws:CalledVia is CloudFormation;
      • describe the install stack, call GetRole on the reader and GetTemplateSummary, and write its own log.
    • Unchanged: the boundary and the deploy role.
  • infra/lib/service-env.ts: sets INSTALL_READER_KEPT=1 on one-stack installs only. A CLI install keeps the quiet in-app item for its own account.
  • Updater (lambda/updater/handler.py): when an existing access stack lacks the reader update, access_compute asks for the access stack once ("adds the reader update"). An install with no access stack gets it through the same one link.
  • Docs:
    • self-host/integrations.md: the alert sentence is removed, and the own-account reads now say they come with the release.
    • self-host/security.md: a new "The reader update" section, and the exception added to the role rules.
    • self-host/updates.md.
  • Incident: rq_reader_reads_arrive_with_the_release (test and page).

The dashboard copy for the install's own account is in CoderHelm/coderhelm (CoderHelm/coderhelm#461).

Verification

  • cargo fmt --check --all: clean.
  • rustfmt --check --edition 2021 worker/src/passes/incidents/*.rs: clean.
  • cargo clippy -p common -p gateway -p worker --all-targets -- -D warnings: clean.
  • cargo test -p common -p gateway -p worker (the full run): common 2852 passed, worker 2309 passed, gateway 1087 passed, integration tests 2 and 3 passed, 0 failed. This includes the 5 tests of the rq incident and the new unit tests.
  • The builder test fails on main. With main's builder put back (install_account: false in PermissionCheck), rq::the_checks_own_builder_marks_the_install_account and rq::the_install_account_shows_nothing_to_do fail. With the fix they pass.
  • python3 -m unittest discover -s lambda/tests: 580 passed. New:
    • test_native_reader.py (12 tests): the stack is created from the release's update template; every declared parameter is given and only read-only groups are on; the next release updates the same stack; already current, no role, busy and a failed first create are each handled; it always answers SUCCESS.
    • test_updater_access.py, ReaderUpdate (4 tests): an access stack without the reader update is asked for once, and never again after.
  • infra npm test: 188 of 188 passed. New:
    • the reader update's rules and inline code;
    • its policy, checked with the IAM evaluator: only that stack, only from a release's update template, only that role's policy, only through CloudFormation;
    • no CoderHelm role can reach it under the boundary;
    • native gateway and worker carry INSTALL_READER_KEPT=1, and a CLI install does not.
  • A native release was built and cfn-lint ran as CI does, on infra/cfn/*.yaml, coderhelm.json, access.json and stacks/*.json: clean.
  • node --test selfhost/launch/*.test.mjs: 16 of 16 passed.
  • No AWS calls were made.

…ase, and no alert ever

The daily AWS permissions sweep pushed "AWS account X needs N new read-only
permissions" for the install's own account: PermissionCheck.install_account
was only ever set in tests, so that account was treated like any other. And
since every team read there goes through CoderHelmLogReader, that role really
fell behind each release.

- The check's builder sets install_account from the install's read role, on
  one-stack installs (INSTALL_READER_KEPT); saved checks are corrected on read.
- The sweep sends nothing: the message and its told and claim records are
  gone. Another account is the AWS page's quiet item with its one-click stack.
- The access stack's reader update (lambda/native-reader) creates or updates
  CoderHelmLogReaderUpdate-release from the running release's update template
  after each update of the install's stack, daily and on its own create, with
  read-only groups only. Its role may only do that, only from a release's
  update template and only through CloudFormation.
- The updater asks for the access stack once when it lacks the reader update.
- Docs and incident rq_reader_reads_arrive_with_the_release.
@nambok
nambok merged commit 15a0414 into main Nov 19, 2026
10 checks passed
@nambok
nambok deleted the own-account-reader-with-release branch November 19, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant